﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MKS.model;

namespace MarketMS
{
    public partial class BuyGoods : Form
    {
        public  List<GoodsInfo> jiang;
        public GoodsInfo SelectedGood { get; set; }
        public BuyGoods(List<GoodsInfo> list)
        {
            InitializeComponent();
            this.jiang = list;
        }

        private void BuyGoods_Load(object sender, EventArgs e)
        {
            dgvxuanze.AutoGenerateColumns = false;
            dgvxuanze.DataSource = jiang;
        }

        private void dgvxuanze_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (dgvxuanze.SelectedRows.Count == 1)
                {
                    int ind = dgvxuanze.SelectedRows[0].Index;
                    SelectedGood=jiang[ind-1];
                    this.Close();
                }
               
            }
        }

       
    }
}
